<?php
namespace Admin\Controller;
// 基本信息模块
class InfomsgController extends CommonController {
	public function info(){
		$data['id'] = session('userid');
		$user = M('user')->where($data)->find();
		$this->assign('user',$user);
		$this->display();
	}

	public function edit(){
		$id = session('userid');
		$data = I('post.');
		$msg['account'] = $data['account'];
		$user = M('user')->field('id')->where($msg)->find();
		if($id == $user['id']){
			$this->mtReturn(200, '修改成功！','','forward','/index.php?m=Admin&c=Infomsg&a=info');
			exit;
		}
		if($user){
			$this->mtReturn(300, '账户名已存在,请重新输入！');
			exit;
		}
		$edit = D('user')->where("id=".$id)->save($data);
		if($edit){
			$this->mtReturn(200, '修改成功！','','forward','/index.php?m=Admin&c=Infomsg&a=info');
		}else{
			$this->mtReturn(300, '修改失败！');
		}
	}
}
?>